package multiThreadTest;

public class TestThread {
    public static void main(String[] args) {
        MyThread mt1=new MyThread("AAAAAA");
        MyThread mt2=new MyThread("BBB");
        MyThread mt3=new MyThread("C");
        mt1.setPriority(1);
        mt2.setPriority(10);
        mt3.setPriority(5);

        Thread.currentThread().setName("wwwwwwww");
        mt1.start();
        try {
            mt1.join();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        mt2.setDaemon(true);
        mt3.setDaemon(true);
        mt2.start();
        mt3.start();
        System.out.println(Thread.currentThread().getName());
        System.out.println(mt1.getPriority());
        System.out.println(mt2.getPriority());
        System.out.println(mt3.getPriority());
        System.out.println(Thread.currentThread());
        for (int i = 0; i < 50; i++) {
            System.out.println(Thread.currentThread().getName()+":"+i);
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.activeCount());
        }
    }
}
